import React from "react";
import { withRouter } from "react-router-dom";

function cate({ data, history }) {
    console.log(data);
    return (
        <div className="cate">
            {data.map((item, index) => (
                <div
                    className="cate-item"
                    key={index}
                    onClick={() => {
                        history.push({
                            pathname: "/category",
                            state: { id: item.get("id") },
                        });
                    }}
                >
                    <img src={item.get("picUrl")} alt="" />
                    <span>{item.get("text")}</span>
                </div>
            ))}
        </div>
    );
}
export default withRouter(cate);
